package com.anlu.base.function.util;

import com.anlu.base.function.mode.FormComponentBaseBO;
import com.anlu.base.function.mode.FormComponentValueBaseBO;
import com.anlu.base.function.mode.FormVO;
import org.apache.tomcat.util.buf.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

import static com.anlu.base.function.enums.FunEnum.ValueFunction.SELECT;

public abstract class FormComponentUtil {

    private final static Logger logger = LoggerFactory.getLogger(FormComponentUtil.class);

    public static String valueString(FormComponentBaseBO bo){
        switch (bo.getType()){
            case TEXT -> {
                logger.info("value={}",bo.getValue().toString());
                return "text";
            }
            case BOOLEAN -> {
                return "boolean";

            }
            case SELECT -> {
                return "select";
            }
        }
        return null;
    }

    public static FormVO of(FormComponentBaseBO bo){
        FormVO valueBaseBO = new FormVO();
        valueBaseBO.setValueString(valueString(bo));
        return valueBaseBO;
    }
}
